﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace CardClass
{
    public class PlayerPanel : Control
    {
        Rectangle border;
        SolidColorBrush brush_border = new SolidColorBrush();
        TextBlock PlayerID;
        TextBlock HP;
        TextBlock Cards;
        FrameworkElement implementationRoot;

        RotateTransform rotate;
        TranslateTransform translate;

        public PlayerPanel()
        {
            System.IO.Stream s = this.GetType().Assembly.GetManifestResourceStream("CardClass.PlayerPanel.xaml");
            implementationRoot = this.InitializeFromXaml(new System.IO.StreamReader(s).ReadToEnd());

            border = implementationRoot.FindName("border") as Rectangle;
            PlayerID = implementationRoot.FindName("PlayerID") as TextBlock;
            HP = implementationRoot.FindName("HP") as TextBlock;
            Cards = implementationRoot.FindName("Cards") as TextBlock;
            rotate = implementationRoot.FindName("Rotate") as RotateTransform;
            translate = implementationRoot.FindName("Translate") as TranslateTransform;

            this.Width = 200;
            this.Height = 50;
        }

        public virtual new double Height
        {
            get { return implementationRoot.Height; }
            set
            {
                implementationRoot.Height = value;
                border.Height = value;
            }
        }
        public virtual new double Width
        {
            get { return implementationRoot.Width; }
            set
            {
                implementationRoot.Width = value;
                border.Width = value;
            }
        }
        public String PlayerIDText
        {
            get { return PlayerID.Text; }
            set { PlayerID.Text = value; }
        }
        public String HPText
        {
            get { return HP.Text; }
            set { HP.Text = value; }
        }
        public String CardsText
        {
            get { return Cards.Text; }
            set { Cards.Text = value; }
        }
        public Color BorderColor
        {
            get { return brush_border.Color; }
            set
            {
                brush_border.Color = value;
                border.Stroke = brush_border;
            }
        }
        public double Left
        {
            get { return translate.X; }
            set { translate.X = value; }
        }
        public double Top
        {
            get { return translate.Y; }
            set { translate.Y = value; }
        }
        public double Angle
        {
            get { return rotate.Angle; }
            set { rotate.Angle = value; }
        }
    }
}
